<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="card-body">
                <div class="basic-form">
                    <form method="post" action="index.php?r=post/image"  enctype="multipart/form-data" >
                        <input type="hidden" name="post_id" value="<?php echo $post_id; ?>">
                        <input type="hidden" name="post_type" value="image">
                        <input type="hidden" name="action_type" value="<?php echo $post_id==0?"insert":"update"; ?>">
                        <div class="form-group">
                            <input type="text" name="title" value="<?php echo $post['title']; ?>" minlength="0"
                                   maxlength="60" class="form-control" placeholder="标题">
                        </div>
                        <div class="form-group">
                            <textarea class="form-control" name="content" rows="10" minlength="1" maxlength="10000"
                                      placeholder="内容" style="height: 500px;"><?php echo $post['content']; ?></textarea>
                        </div>
                        <?php
                        if(isset($meta)&&isset($meta['imagePath'])){
                            ?>
                            <div class="form-group">
                                <label>图像预览：</label>
                                <div class="clearfix"></div>
                                <img class="img-thumbnail" src="../<?php echo $meta['imagePath'] ?>"   />
                            </div>
                            <?php
                        }
                        ?>
                        <div class="form-group">
                            <input type="file" name="image" class="form-control" placeholder="图片">
                        </div>
                        <div class="form-group">
                            <select name="category_id" class="form-control" placeholder="分类">
                                <?php
                                foreach ($categorys as $category) {
                                    if ($post['category_id'] == $category['category_id']) {
                                        ?>
                                        <option value="<?php echo $category['category_id']; ?>"
                                                selected="selected"><?php echo $category['categoryname']; ?></option>
                                        <?php
                                    } else {
                                        ?>
                                        <option value="<?php echo $category['category_id']; ?>"><?php echo $category['categoryname']; ?></option>
                                        <?php
                                    }
                                }
                                ?>
                            </select>
                        </div>
                        <button type="submit" class="btn btn-primary btn-block">提交</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!-- /# column -->
</div>
<!-- /# row -->